#include<stdio.h>
int findlinemax(int a[100][100], int line, int column);//返回列标
int judege(int a[100][100], int line, int column,int currentline);//判断是否正确
int main()
{
    int n,m,cnt=0;
    int matrix[100][100];
    scanf("%d %d", &n,&m);
    for(int i=0;i<n;i++)
     for(int j=0;j<m;j++)
      scanf("%d",&matrix[i][j]);
    for(int i=0;i<n;i++)
    {
        int columnindex;
        if(n==1) columnindex=findlinemax(matrix,i,m);//只有一行的情况
        else if(judege(matrix,n,findlinemax(matrix,i,m),i)!=-1);//有多行，如果是最小值返回列标否则返回-1
          { 
            cnt++;
            printf("The saddle point is (%d,%d)=%d.",i,columnindex=findlinemax(matrix,i,m),matrix[i][columnindex=findlinemax(matrix,i,m)]);
            break;
          }
    }
    if(cnt==0) printf("there is no saddle point in the matrix.");
    return 0;
}


int findlinemax(int a[100][100], int line, int column)
{
    int max=a[line][0],index=0;
    for(int i=1;i<column;i++)
    {
        if(a[line][i]>max)
        {
            max=a[line][i];
            index=i;
        }
    }
    return index;
}

int judege(int a[100][100], int line, int column,int currentline)
{
    int min=a[currentline][column], index=column;
    for(int i=0;i<line;i++)
    {
        if(a[i][column]<min) 
        {
            index=-1;
            break;
        }
    }
    return column;
}//以上为自己写的，以下为网上答案




#include<stdio.h>

int main() {
    int a[110][110];
    int n,m;
    scanf("%d%d",&n,&m);
    for (int i = 0; i <n ; i++) {
        for (int j = 0; j <m ; j++) {
            scanf("%d",&a[i][j]);
        }
    }
    int max,min;
    int b,c;
    for (int i = 0; i <n ; i++) {
        max=a[i][0];
        c=0;
        b=i;
        for (int j = 0; j <m ; j++) {
            if (a[i][j]>max){
                max=a[i][j];
                c=j;
            }
        }
        min=max;
        for (int j = 0; j <n ; j++) {
            if (a[j][c]<min){
                min=a[j][c];
                b=j;
            }
        }
        if (b==i){
            printf("The saddle point is (%d,%d)=%d.",b,c,a[b][c]);
            return 0;
        }
    }
    printf("There is no saddle point in the matrix.");
    return 0;
}





